﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using System.Data;
using KPIS.Utils;
using KPIS.DBM;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.MODEL;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class PR_BonusCommandDtls : System.Web.UI.UserControl
    {
        RadComboBox cmbAprJobSite;
        RadComboBox cmbPrmJobSite;
        private object _dataItem = null;
        public void IncludeJava()
        {
            HtmlGenericControl script = new HtmlGenericControl();
            script.TagName = "script";
            script.Attributes.Add("type", "text/javascript");
            script.Attributes.Add("src", "../../Scripts/jsfunction.js");
            Page.Header.Controls.Add(script);
        }
        protected void Page_Load(object sender, EventArgs e)
        {

          
            
        }

        protected bool IsUserControlPostBack
        {
            get
            {
                return this.ViewState["IsUserControlPostBack"] != null;
            }
        }

  

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            IncludeJava();
            if (!IsUserControlPostBack)
            {











                this.ViewState.Add("IsUserControlPostBack", true);

            }
      
            if (DataItem != null)
            {
                //   cbGender.ListGenderComboBox();
                if (!(DataItem is Telerik.Web.UI.GridInsertionObject))
                {
                    //lblSeq.Text = DataBinder.Eval(DataItem, "req_seq").ToString();
                    //txtNo.Text = DataBinder.Eval(DataItem, "seq").ToString();
                    //txtReason.Text = DataBinder.Eval(DataItem, "reason").ToString();
                    //cmbJobsite.SelectedValue = DataBinder.Eval(DataItem, "job_site_seq").ToString();
                    //cmbInqSubject.SelectedValue = DataBinder.Eval(DataItem, "inquire_seq").ToString();
                    //this.ViewState.Add("IsUserControlPostBack", true);

                }
                else
                {
                
           
                }
                btnUpdate.Visible = !(DataItem is Telerik.Web.UI.GridInsertionObject);
                btnAddnew.Visible = (DataItem is Telerik.Web.UI.GridInsertionObject);
            }
        }

        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }

        protected void btnAddnew_Click(object sender, EventArgs e)
        {
       
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
          

        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }

        private IEmployeeBLL empBLL = new EmployeeBLL();
        protected void btnFindEmp_Click(object sender, ImageClickEventArgs e)
        {
           
                string st = Hide.Value;
                EmployeeInfo infoEmp;
                IList<EmployeeInfo> infoList = empBLL.ListEmployees(st);
                infoEmp = infoList[0];

                lblID_emp.Text = infoEmp.Sequence.ToString();

                lblID_pos.Text = infoEmp.Position.Sequence.HasValue == true ? infoEmp.Position.Sequence.ToString() : "";

                lblID_class.Text = infoEmp.Class.Sequence != null ? infoEmp.Class.Sequence.ToString() : "";

                lblID_jobSite.Text = infoEmp.WorkingJobSite.Sequence.HasValue == true ? infoEmp.WorkingJobSite.Sequence.ToString() : "";

                txtEmp.Text = infoEmp.Person.FullName;
                //lblPosRef.Text = infoEmp.Position.RefNo;
                lblPositionName.Text = infoEmp.Position.Name;
                lblClassName.Text = infoEmp.Position.ClassSpecification.Name;
                lblWorkingJobsiteName.Text = infoEmp.WorkingJobSite.Name;
                lbl_Salary.Text = infoEmp.Salary.ToString();  
         
          
        }

        protected void btnFindEmp_Load(object sender, EventArgs e)
        {


            string ETID = Session["ETID"].ToString();

            //btnFindEmp.Attributes.Add("OnClick", "LinkMDdetail(" + Hide.ClientID + "," + "'Forms/DialogEmp.aspx?ETID=" + ETID + "&JSID=" + JSID + "','../frmIframe.html',700,500)");
            btnFindEmp.Attributes.Add("OnClick", "LinkMDdetail(" + Hide.ClientID + "," + "'Forms/DialogEmp.aspx?ETID=" + ETID + "','../frmIframe.html',700,500)");
        }

 
    }
}